package com.framework.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;

@Configuration
public class ViewTemplateConfig {

	@Value("${basePackages}")
	private String BASE_PACKAGES;

	@Bean
	public ViewResolver jspViewResolver(){
		InternalResourceViewResolver jspResolver = new InternalResourceViewResolver();
		jspResolver.setViewClass(JstlView.class);
		jspResolver.setPrefix("/WEB-INF/views/");
		jspResolver.setSuffix(".jsp");
		return jspResolver;
	}

	/**
	 * JadeViewResolver
	 * *.jade 템플릿
	 *
	 * @return
	 */
//	@Bean
//	private ViewResolver jadeViewResolver() {
//		JadeViewResolver viewResolver = new JadeViewResolver();
//		viewResolver.setRenderExceptions(true);
//		JadeConfiguration configuration = new JadeConfiguration();
//		configuration.setPrettyPrint(false);
//		configuration.setCaching(false);
//		SpringTemplateLoader templateLoader = new SpringTemplateLoader();
//		templateLoader.setBasePath("/WEB-INF/views/");
//		templateLoader.setEncoding("UTF-8");
//		templateLoader.setSuffix(".jade");
//		configuration.setTemplateLoader(templateLoader );
//		viewResolver.setConfiguration(configuration);
//		return viewResolver;
//	}
}
